#pragma once

#include "DX11Includes.h"
#include "AlignedMemoryBase.h"
/// GOOOOD RESOURCE 
/// http://www.toymaker.info/Games/html/camera.html

class Camera : public AlignedMemoryBase
{
	/*******************************************************************
	* Members
	********************************************************************/
protected:

	//matrices
	XMMATRIX viewMatrix;
	XMMATRIX projectionMatrix;	

	XMVECTOR  position;      // camera position
	FLOAT yaw;                 // rotation around the y axis
	FLOAT pitch;               // rotation around the x axis
	FLOAT roll;                // rotation around the z axis
	XMVECTOR  up,look,right; // camera axis	
	XMVECTOR _target; 

	
	/*******************************************************************
	* Methods
	********************************************************************/
public:

	//constructor and destructor
	Camera();
	~Camera();

	//set projection methods
	void SetPerspectiveProjection( FLOAT FOV, FLOAT aspectRatio, FLOAT zNear, FLOAT zFar );		

	void AddYawPitchRoll(FLOAT yaw, FLOAT pitch, FLOAT roll);
	void SetYawPitchRoll(FLOAT yaw, FLOAT pitch, FLOAT roll);

	void SetPosition(float x, float y, float z) {position = XMVectorSet(x,y,z,0);}
	void AddPosition(float x, float y, float z) {position += XMVectorSet(x,y,z,0);}
	XMVECTOR GetPosition() {return position; }	
	XMVECTOR GetTarget() {return _target; }	
	
	//get methods
	XMMATRIX& getViewMatrix() { return viewMatrix; }
	XMMATRIX& getProjectionMatrix() { return projectionMatrix; }
	
	virtual void UpdateCamera(int elapsedTime);

};
